package cn.kgc.dmuserprovider.service;


import cn.kgc.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserService {


    Logger logger= LoggerFactory.getLogger(UserService.class);
    @RequestMapping("/login")
    public boolean login(@RequestParam("userName") String userName,@RequestParam("userPass") String userPass,@RequestParam("count") Integer count){


        logger.info("access 8080 provider"+(count++));
        if ("admin" .equals(userName)&&"0".equals(userPass)){
            return true;
        }else {
            return false;
        }
    }

    @RequestMapping(value = "/register",method = RequestMethod.POST)
   public boolean register(@RequestBody User user){

        //调用DAO，将该对象放入关系数据库中
     if (user!=null && "admin".equals(user.getUserName())){
         return false;
     }
     return true;
    }
}
